home *** CD-ROM | disk | FTP | other *** search
- on pongPaddleMove
- global giPongPaddleChannel, giPaddleHalfWidth
- set the locH of sprite giPongPaddleChannel to the mouseH - giPaddleHalfWidth
- end
-
- on soundPaddleHit
- puppetSound("PaddlePoing")
- end
-
- on updateScore piLevel
- global giPongScore, glPingSounds, glBrickList
- set the text of cast "PongScore" to string(giPongScore)
- if integerp(piLevel) then
- set lsSoundName to getAt(glPingSounds, piLevel)
- puppetSound(lsSoundName)
- end if
- if max(max(glBrickList)) = 0 then
- pongNewLevel()
- end if
- end
-
- on pongNewLevel
- global giPongLevel, giPongPaddleChannel, giPlayFieldBottomBoundary, glBulletsInPlay, gbDuck, giPongBall
- set giPongLevel to giPongLevel + 1
- if giPongLevel > 1 then
- waitForTicks(30)
- pongBonus(giPongLevel)
- end if
- set the text of field "PongLevel" to string(giPongLevel)
- updateStage()
- repeat with counter = 1 to count(glBallsInPlay)
- mPongBallReset(getAt(glBallsInPlay, counter))
- end repeat
- repeat with counter = 1 to count(glBulletsInPlay)
- mPongBulletReset(getAt(glBulletsInPlay, counter))
- end repeat
- set liPaddleSize to 9 - integer((giPongLevel / 2) + 0.5)
- if liPaddleSize < 1 then
- set liPaddleSize to 1
- end if
- set liPaddleLevel to integer((giPongLevel / 3) + 0.5)
- if liPaddleLevel > 9 then
- set liPaddleLevel to 9
- end if
- set lsBrickType to "pongBrick"
- set gbDuck to 0
- set liRows to integer(giPongLevel mod 10 / 2)
- set liTopOffset to 0
- if liRows < 2 then
- set liRows to liRows + random(3)
- end if
- set liColumns to (giPongLevel mod 16) + 8
- put "liRows = " & liRows
- put "liColumns = " & liColumns
- put "liTopOffset = " & liTopOffset
- pongBuildWall(lsBrickType, liRows, liColumns, liTopOffset)
- pongInitBrickList(liRows, liColumns)
- pongPaddleChange(liPaddleSize)
- pongPaddleLevel(liPaddleLevel)
- set the text of cast "PongBall" to string(giPongBall - 1)
- end
-
- on pongNewBall
- global giPongBall, giPongSplashChannel, giHideOffset
- if giPongBall > 1 then
- set giPongBall to giPongBall - 1
- set the text of field "PongBall" to string(giPongBall - 1)
- updateStage()
- else
- pongGameOver()
- end if
- set the locH of sprite giPongSplashChannel to giHideOffset
- end
-
- on pongPaddleLevel piLevelNum
- global giPongPaddleChannel, giPlayFieldBottomBoundary
- set the locV of sprite giPongPaddleChannel to giPlayFieldBottomBoundary - ((14 * piLevelNum) + 10)
- debugMessage("pongPaddleLevel completed w/ piLevelNum = " & piLevelNum)
- end
-
- on pongGameOver
- global gbPaused
- go("GameOver")
- set gbPaused to 1
- end
-
- on pongBonus pongLevel
- global giBonusChannel, giPongScore
- set pongLevel to pongLevel - 1
- set bonusMultiplier to 5 * pongLevel
- set pongBonus to pongLevel * 10 * bonusMultiplier
- set the text of cast "bonus" to "Level" && pongLevel && "Bonus =" && pongBonus
- set the visible of sprite giBonusChannel to 1
- set the locH of sprite giBonusChannel to 130
- puppetSound("clickOne")
- updateStage()
- waitForTicks(100)
- repeat with i = 1 to pongLevel * bonusMultiplier
- set the text of cast "bonus" to "Level" && pongLevel && "Bonus =" && string(pongBonus - (i * 10))
- set the text of cast "pongScore" to string(value(the text of cast "pongScore") + 10)
- puppetSound("clickOne")
- updateStage()
- waitForTicks(5)
- end repeat
- waitForTicks(45)
- set the visible of sprite giBonusChannel to 0
- set the locH of sprite giBonusChannel to 1000
- puppetSound("clickOne")
- updateStage()
- set giPongScore to giPongScore + pongBonus
- end
-